CC ?= ${CROSS-BULID}g++
AR ?= ${CROSS-BUILD}ar
CFLAGS += -Wall -O2 -I../include -O2 `pkg-config --cflags opencv`
LDFLAGS += -L../lib -lC_CamDet -lpthread `pkg-config --libs opencv`

# libs
LIB_CAMERALOCATE = ../lib/libC_CamDet.a
LIBS = ${LIB_CAMERALOCATE}

PUBLIC_HEADER = ../include/C_CamDet.h

# DEPEND_DIRS =
OBJS = CameraDetect.o Marker_J.o

default: ${LIB_CAMERALOCATE} ${PUBLIC_HEADER} demo

demo: demo.o
	g++ ${CFLAGS} -o $@ $^ ${LDFLAGS}

# libs and objs
.PHONY: demo clean distclean
CameraDetect.o: CameraDetect.cpp
	g++ -c $(CFLAGS) $<
Marker_J.o: Marker_J.cpp
	g++ -c $(CFLAGS) $<

${LIB_CAMERALOCATE}: CameraDetect.o Marker_J.o
	${AR} rcs $@ $^
${PUBLIC_HEADER}: C_CamDet.h
	cp $< $@

# cleanup
clean:
	${RM} demo
distclean: clean
	${RM} demo.o ${OBJS} ${LIB_CAMERALOCATE} ${PUBLIC_HEADER}
